package com.javasm.adminapi.aftersales.controller;

import com.github.pagehelper.PageInfo;
import com.javasm.adminapi.aftersales.service.RepairShopService;
import com.javasm.adminapi.common.R;
import com.javasm.adminapi.module.aftersalesbase.entity.Repair;
import com.javasm.adminapi.module.aftersalesbase.entity.RepairType;
import com.javasm.adminapi.module.aftersalesbase.service.RepairService;
import com.javasm.adminapi.module.aftersalesbase.vo.SearchVo;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @className: RepairController
 * @description:
 * @author: zjl
 * @date: 2025/10/15 9:48
 * @version: 0.1
 * @since: jdk17
 */
@RestController
@RequestMapping("/repair")
public class RepairShopController {

    @Resource
    RepairShopService repairShopService;

    @GetMapping("/query")
    public R queryByCondition(SearchVo searchVo){
        PageInfo<Repair> pageInfo =repairShopService.queryByCondition(searchVo);
        return R.ok(pageInfo);
    }

    @PostMapping("/save/update")
    public R saveOrUpdate(Repair repair){
        repairShopService.saveOrUpdate(repair);
        return R.ok();
    }

    @DeleteMapping("/delete/{ids}")
    public R delete(@PathVariable Integer[] ids){
        repairShopService.removeByIds(ids);
        return R.ok();
    }

    @GetMapping("/pro/city")
    public R ProCityList(){
        List<RepairType> list =repairShopService.proCityList();
        return R.ok(list);
    }

}
